//
//  BHSportClockTimeCell.swift
//  BigHealth
//
//  Created by 蔺百好 on 2021/7/16.
//

import UIKit

class BHSportClockTimeCell: UITableViewCell {

    @IBOutlet weak var back_view: UIView!
    
    @IBOutlet weak var time_label: UILabel!
    
    @IBOutlet weak var clock_btn: UIButton!
    
    var model: BHSportPlanModel? {
        didSet {
            if model == nil {
                return
            }
            
            self.time_label.text = model?.clockTime
            
            // 0:待打卡  1:已打卡  2:缺卡
            if model?.clockStatus == 1 {
                self.back_view.backgroundColor = .color_E0F5ED
                self.clock_btn.setTitle("已打卡", for: .normal)
                self.clock_btn.setTitleColor(.color_34CE98, for: .normal)
                self.clock_btn.addLayerCorner(16, 0.5, .color_34CE98)
                self.clock_btn.backgroundColor = .color_E0F5ED
            }else if model?.clockStatus == 2 {
                self.back_view.backgroundColor = .color_FFF9ED

                self.clock_btn.setTitle("缺卡", for: .normal)
                self.clock_btn.setTitleColor(.color_FFBF43, for: .normal)
                self.clock_btn.addLayerCorner(16, 0.5, .color_FFBF43)
                self.clock_btn.backgroundColor = .color_FFF9ED

            }else {
                self.back_view.backgroundColor = .color_f8f8f8
                self.clock_btn.setTitle("打卡", for: .normal)
                self.clock_btn.setTitleColor(.white, for: .normal)
                self.clock_btn.addLayerCorner(16, 0.5, .color_34CE98)
                self.clock_btn.backgroundColor = .color_34CE98
            }
        }
    }
    
    
    override func awakeFromNib() {
        super.awakeFromNib()
       
        self.back_view.addLayerCorner(4, 0, .white)
        self.clock_btn.addLayerCorner(16, 0, .white)

        
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

     
    }
    
}
